-
-
Notifications
You must be signed in to change notification settings - Fork 40
feat: NativeScript bootstrap transformer #634
Conversation
templates/webpack.angular.js
Outdated
@@ -3,6 +3,7 @@ const { join, relative, resolve, sep } = require("path"); | |||
const webpack = require("webpack"); | |||
const nsWebpack = require("nativescript-dev-webpack"); | |||
const nativescriptTarget = require("nativescript-dev-webpack/nativescript-target"); | |||
const { nsReplaceBootstrap } = require("nativescript-dev-webpack/plugins/ns-replace-bootstrap"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you reexport that from the index file?
const entryModule = aot ? | ||
nsWebpack.getAotEntryModule(appFullPath) : | ||
`${nsWebpack.getEntryModule(appFullPath)}.ts`; | ||
const entryModule = `${nsWebpack.getEntryModule(appFullPath)}.ts`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the getAotEntryModule
function from index.js as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a breaking change if we remove it completely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. We discussed to introduce a Deprecated
decorator in another PR.
templates/webpack.angular.js
Outdated
const ngCompilerPlugin = new AngularCompilerPlugin({ | ||
hostReplacementPaths: nsWebpack.getResolver([platform, "tns"]), | ||
platformTransformers: aot ? [nsReplaceBootstrap(() => ngCompilerPlugin)] : null, | ||
mainPath: resolve(appPath, "main.ts"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops, that's from a previous PR (mine ;d), but I think it should be mainPath: entryModule
instead of hardcoded to main.ts.
tsconfig.json
Outdated
@@ -10,6 +10,7 @@ | |||
"files": [ | |||
"plugins/PlatformFSPlugin.ts", | |||
"plugins/WatchStateLoggerPlugin.ts", | |||
"plugins/ns-replace-bootstrap.ts", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mm, that's not really a webpack plugin. Can we move it to a transformers
folder or something like that.
The bootstrap transformer will automatically replace the platform and bootstrap calls inside `main.ts` when building with AOT. This will eliminate the need for `main.aot.ts` and `app.module.ngfactory.d.ts` files in templates.
This won't work for projects that don't have dependency for `@ngtools/webpack`.
e65d008
to
c3a3b0b
Compare
It was removed (probably accidentally) in #634.
It was removed (probably accidentally) in #634.
<a name="0.16.0"></a> # [0.16.0](0.15.1...0.16.0) (2018-09-10) ### Features * NativeScript bootstrap transformer ([#634](#634)) ([c016418](c016418))
They won't be needed with {N}-dev-webpack 0.16.0, because of this change - NativeScript/nativescript-dev-webpack#634.
The bootstrap transformer will automatically replace the platform and bootstrap calls inside
main.ts
when building with AOT.This will eliminate the need for
main.aot.ts
andapp.module.ngfactory.d.ts
files in templates.This depends on angular/angular-cli#11786 going public